<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-ctrWlInfo-edit" th:object="${ctrWlInfo}">
            <input id="wlId" name="wlId" th:field="*{wlId}"  type="hidden">
            <input id="ctrId" name="ctrId" th:field="*{ctrId}" type="hidden">
            <div class="form-group">	
                <label class="col-sm-3 control-label">人员级别：</label>
                <div class="col-sm-8">
                    <select id="wlLevel" class="form-control m-b" th:with="type=${@dict.getType('pm_emp_level')}">
                    	<option value="">请选择...</option>
	                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"  th:field="*{wlLevel}"></option>
	                </select>
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">人员单价：</label>
                <div class="col-sm-8">
                    <input id="wlUnp" name="wlUnp" th:field="*{wlUnp}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">人数：</label>
                <div class="col-sm-8">
                    <input id="wlQuty" name="wlQuty" th:field="*{wlQuty}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">人月数：</label>
                <div class="col-sm-8">
                    <input id="wlPmons" name="wlPmons" th:field="*{wlPmons}" class="form-control" type="text">
                </div>
            </div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "pm/ctrWlInfo"
		$("#form-ctrWlInfo-edit").validate({
			rules:{
				wlLevel:{
					required:true,
				},
				wlUnp:{
					required:true,
				},
				wlQuty:{
					required:true,
				},
				wlPmons:{
					required:true,
				}
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	        	edit();
	        }
	    }
		
		function edit() {
			var wlId = $("input[name='wlId']").val();
        	var wlLevel = $("#wlLevel option:selected").val();
        	var wlUnp = $("input[name='wlUnp']").val();
        	var wlQuty = $("input[name='wlQuty']").val();
        	var wlPmons = $("input[name='wlPmons']").val();
        	var ctrId = $("input[name='ctrId']").val();
        	$.ajax({
        		cache : true,
        		type : "POST",
        		url : ctx + "pm/ctrWlInfo/edit",
        		data : {
        			"wlId": wlId,
        			"wlLevel": wlLevel,
        			"wlUnp": wlUnp,
        			"wlQuty": wlQuty,
        			"wlPmons": wlPmons,
        			"ctrId": ctrId
        		},
        		async : true,
        		error : function(request) {
        			$.modal.alertError("系统错误");
        		},
        		success : function(data) {
        			$.operate.saveSuccess(data);
        		}
        	});
        }
	</script>
</body>
</html>
